//
//  HomePlayCell.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 2017/5/16.
//  Copyright © 2017年 EasyToTesco. All rights reserved.
//

#import "HomePlayCell.h"

#import "SectionView.h"
#import "HomePlayView.h"

@interface  HomePlayCell()

@property(nonatomic,strong)SectionView  *sectionView;
@property(nonatomic,strong)HomePlayView *playView;

@end

@implementation HomePlayCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self buildSubViews];
    }
    return self;
}

- (void)buildSubViews
{
    [self.contentView addSubview:self.sectionView];
    
    CGFloat leftMargin = 15;
    CGFloat centerMargin = 10;
    CGFloat ViewW = (WIDTH - leftMargin*2 - centerMargin*2)/3;
    
    for (int i = 0; i < 3; ++i) {
        
        self.playView = [[HomePlayView alloc] init];
        [self.contentView addSubview:_playView];
        _playView.tag = i;
        [_playView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(playClick:)]];
        _playView.frame = CGRectMake(leftMargin + i*(ViewW+centerMargin),CGRectGetMaxY(self.sectionView.frame),ViewW,140);
        _playView.contentImg.image = [UIImage imageNamed:[NSString stringWithFormat:@"bg_recommend%d",i]];
        _playView.contentPrice.text = @"1000美金";
        _playView.contentLabel.text = @"最坚强的肌肉是我的心,瓦斯不灵大?????";
    }
    
}

- (void)playClick:(UIGestureRecognizer *)recognizer
{
    
}


#pragma mark lazy
- (SectionView *)sectionView
{
    if (!_sectionView) {
        _sectionView = [[SectionView alloc] initWithFrame:CGRectMake(0,0,WIDTH,40)];
        _sectionView.titleLabel.text = @"当季热玩";
    }
    return _sectionView;
}




@end
